/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Formularios;

import conexion.Conexion;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.JOptionPane;

/**
 *
 * @author FRANCISCO
 */
public class Plataforma extends javax.swing.JFrame {

    /**
     * Creates new form Plataforma
     */
    public Plataforma() {
        initComponents();
        this.setLocationRelativeTo(null);
        this.setResizable(false);
        conexion();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        btnventa = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        btnproducto = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        btndia = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(3, 0), new java.awt.Dimension(3, 0), new java.awt.Dimension(3, 32767));
        filler2 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 32767));

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("PLATAFORMA PRINCIPAL");
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        btnventa.setText("NUEVA VENTA");
        btnventa.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnventaActionPerformed(evt);
            }
        });
        getContentPane().add(btnventa, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 170, 153, 40));

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/iconos/cliente.png"))); // NOI18N
        getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 40, 140, 130));

        btnproducto.setText("PRODUCTOS");
        btnproducto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnproductoActionPerformed(evt);
            }
        });
        getContentPane().add(btnproducto, new org.netbeans.lib.awtextra.AbsoluteConstraints(450, 180, 150, 40));

        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/iconos/producto.png"))); // NOI18N
        getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(460, 30, 140, 130));

        btndia.setText("TOTAL DIARIO");
        btndia.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btndiaActionPerformed(evt);
            }
        });
        getContentPane().add(btndia, new org.netbeans.lib.awtextra.AbsoluteConstraints(310, 440, 150, 40));

        jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/iconos/proveedores.png"))); // NOI18N
        getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(320, 280, -1, -1));

        jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/iconos/Mundo PNG (2) (1).png"))); // NOI18N
        getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(680, 210, 300, 310));

        jLabel5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/iconos/energia_azul-1024x768.jpg"))); // NOI18N
        getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, -20, 1000, 550));
        getContentPane().add(filler1, new org.netbeans.lib.awtextra.AbsoluteConstraints(710, 130, -1, -1));
        getContentPane().add(filler2, new org.netbeans.lib.awtextra.AbsoluteConstraints(750, 190, -1, -1));

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnventaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnventaActionPerformed
       nuevaventa nue = new nuevaventa();
       nue.setVisible(true);
       dispose();
       
    }//GEN-LAST:event_btnventaActionPerformed

    private void btnproductoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnproductoActionPerformed
productos pro = new productos();
pro.setVisible(true);
dispose();


    }//GEN-LAST:event_btnproductoActionPerformed

    private void btndiaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btndiaActionPerformed
estadisticas es = new estadisticas();
es.setVisible(true);
dispose();
    }//GEN-LAST:event_btndiaActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Plataforma.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Plataforma.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Plataforma.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Plataforma.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Plataforma().setVisible(true);
            }
        });
    }
    
    
    private void conexion(){
        
      String direcion,bd,nombre,clave;
      try {
          
          
    Conexion co = new Conexion("localhost","pasteleria1211","root","12345");
    co.conectar();
    System.out.println();
        
           // JOptionPane.showMessageDialog(this, "conectado con exito", "Conexion", 1);
            
        } catch (Exception e) {
        JOptionPane.showMessageDialog(this, e.getMessage(), "Conexion", 0);
        System.exit(1);
        }
        
        
    
    }
    
   
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btndia;
    private javax.swing.JButton btnproducto;
    private javax.swing.JButton btnventa;
    private javax.swing.Box.Filler filler1;
    private javax.swing.Box.Filler filler2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    // End of variables declaration//GEN-END:variables
}
